<template>
	<view>
		<view class="header">
			<view class="title">我的订单</view>
			<view class="bottonGroup">
				<view class="botton focus">全部</view>
			</view>
		</view>

		<view style="width: 100%; position: absolute;">
			<view
				style="position: absolute; top: -40rpx; position: absolute; left: 50%; width: 95%; transform: translate(-50%, -3%);">
				<scroll-view scroll-y="true" @scrolltolower="lower" :style="{height: scrollViewHeight+'px'}"
					style="position: initial; bottom: 0; left: 0; right: 0; top: 0;" lower-threshold="200">
					<view
						style="width: 100%; float: left; border-radius: 30rpx; background-color: #fff; margin-top: 20rpx"
						v-for="item in dataList">
						<view style="padding: 0rpx 25rpx">
							<view style="width: 100%; float: left; padding: 10px 0px;">
								<view>
									<view style="border-left: 10rpx solid #FF9941; padding-left: 20rpx; font-size: 30rpx; position: relative; left: -24rpx; margin: 10rpx 0rpx;">
										订单编号：{{item.order_sn}}
									</view>
									<view style="border-bottom: 1px solid #F3F3F3; margin-top: 20rpx; margin-bottom: 20rpx;"></view>
									<view style="display: flex; padding: 5rpx">
										<view style="font-size: 30rpx; color: #777777; width: 25%;">
											活动名称
										</view>
										<view style="font-size: 30rpx; width: 75%;">
											{{item.activity_title}}
										</view>
									</view>
									<view style="display: flex; padding: 5rpx">
										<view style="font-size: 30rpx; color: #777777; width: 25%;">
											姓名
										</view>
										<view style="font-size: 30rpx; width: 75%;">
											{{item.name || '--'}}
										</view>
									</view>
									<view style="display: flex; padding: 5rpx">
										<view style="font-size: 30rpx; color: #777777; width: 25%;">
											手机号
										</view>
										<view style="font-size: 30rpx; width: 75%;">
											{{item.phone || '--'}}
										</view>
									</view>
									<view style="display: flex; padding: 5rpx">
										<view style="font-size: 30rpx; color: #777777; width: 25%;">
											客户类型
										</view>
										<view style="font-size: 30rpx; width: 75%;">
											{{item.customer_type || '--'}}
										</view>
									</view>
									<view style="display: flex; padding: 5rpx">
										<view style="font-size: 30rpx; color: #777777; width: 25%;">
											订单金额
										</view>
										<view style="font-size: 30rpx; width: 75%;">
											{{item.total_price}}
										</view>
									</view>
									<view style="display: flex; padding: 5rpx">
										<view style="font-size: 30rpx; color: #777777; width: 25%;">
											下单时间
										</view>
										<view style="font-size: 30rpx; width: 75%; color: #F25454;">
											{{item.create_time}}
										</view>
									</view>
								</view>
							</view>
						</view>
					</view>
				</scroll-view>
			</view>
		</view>
	</view>
</template>

<script>
	import * as api from '@/api/user'
	import storage from '@/utils/storage'
	export default {
		components: {},
		data() {
			return {

				scrollViewHeight: '',
				dataList: [],
				page: 1,
				limit: 10
			}
		},
		onReady() {
			// 计算 scrollview 高度
			this.scrollViewHeight = uni.getSystemInfoSync().windowHeight - 40 - uni.getMenuButtonBoundingClientRect().top
		},
		onLoad() {
			this.getInfo();
		},
		methods: {
			lower: function(e) {
				this.page = this.page + 1;
				this.getInfo();
			},
			getInfo: function() {
				api.myOrder({
					activityId: storage.get('activityId'),
					page: this.page,
					limit: this.limit
				}).then(res => {
					this.dataList = this.dataList.concat(res.data);
				})
			}
		},
		mounted() {

		}
	}
</script>

<style>
	page {
		background-color: #F6F7FB;
	}

	.header {
		background-color: #FFAC3E;
		position: inherit;
		width: 100%;
		height: 250rpx;
		border-radius: 0rpx 0rpx 20rpx 20rpx;
	}

	.header>.title {
		color: #fff;
		padding: 30rpx;
		font-size: 40rpx;
		font-weight: bold;
	}

	.header>.bottonGroup {
		width: 100%;
		position: initial;
		display: inline-table;
		text-align: center;
		margin-top: 0px;
	}

	.header>.bottonGroup view {
		font-size: 28rpx;
		float: left;
		padding: 5px 10px;
		margin-right: 5px;
		margin: 0px 0px 10px 10px;
		z-index: 999;
	}

	.header>.bottonGroup .botton {
		color: #FFFFFF;
	}

	.header>.bottonGroup .focus {
		border-bottom: 3px solid #FFFFFF;
		color: #FFFFFF;
	}
</style>